package com.foreverwin.jzymes.common.service.impl;

import com.foreverwin.jzymes.common.mapper.ToolAdiviceMapper;
import com.foreverwin.jzymes.common.service.IToolAdiviceService;
import com.foreverwin.jzymes.framework.util.I18nUtil;
import com.foreverwin.jzymes.production.tool.domain.TOOL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.Map;
@Service
public class ToolAdiviceServiceImpl implements IToolAdiviceService {
    @Autowired
    ToolAdiviceMapper toolAdiviceMapper;

    /**刀具是否存在*/
    @Override
    public TOOL selectToolMap(String tool , String site) {
        Assert.hasText( tool, I18nUtil.getI18nText( "production.tool.toolType" ) );
        Assert.hasText( site, I18nUtil.getI18nText( "common.siteNotBlank" ) );

        TOOL toolMap = toolAdiviceMapper.selectToolMap( tool , site);
        Assert.notNull( toolMap, I18nUtil.getI18nText( "production.tool.toolTypeNotExist", new String[]{ tool } ));

        return toolMap;
    }
}
